package com.fancy.display
{
	import com.fancy.display.notice.DisplayLogicNotice;
	import com.fancy.display.notice.DisplayNoticeType;
	import com.fancy.framework.BundleContext;
	import com.fancy.framework.BundleLeader;
	import com.fancy.framework.BundleModuleName;
	import com.fancy.framework.BundleNotice;
	
	public class DisplayLeader extends BundleLeader
	{
		public function DisplayLeader(context:BundleContext)
		{
			super(context);
		}
		
		override public function getModuleName():String
		{
			return BundleModuleName.DISPLAY;
		}
		
		override public function getLevel():uint
		{
			return 1;
		}
		
		override public function initializeLeader():void
		{
			trace("DisplayLeader::initializeLeader()");
			GameStage.init(context.stage);
		}
		
		override public function execute(notice:BundleNotice):void
		{
			trace("DisplayLeader::execute ", notice.type, notice.name, notice.body);
			switch(notice.type)
			{
			case DisplayNoticeType.GAME_LOGIC:
				logicNoticeHandler(notice);
			}
		}
		
		private function logicNoticeHandler(notice:BundleNotice):void
		{
			switch(notice.name)
			{
			case DisplayLogicNotice.SWITCH_GAME_STATE:
				GameStage.switchState(String(notice.body));
				break;
			}
		}
		
	}
}